#include <utility>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <time.h>
#include "basic_cpp.hpp"
#include "import_matrix.hpp"
#include "basic_opencl.hpp"

using namespace std;

const int MATRIX_ROWS = 3000;
const int MATRIX_COLS = 3000;

float * matrix;
float * v;
float * answer;

clock_t init, final;


void main() {
	init=clock();
	matrix = import("matrix.txt", MATRIX_ROWS, MATRIX_COLS);
	v = import("vector.txt", 1, MATRIX_COLS);
	final=clock()-init;

	cout << "Input of matrix/vector took: " << (double)final / ((double)CLOCKS_PER_SEC) << " seconds." << endl;

	init=clock();
	answer = findProduct(matrix, v, MATRIX_ROWS, MATRIX_COLS);	
	final=clock()-init;

	cout << answer[2999] << endl;
	cout << "Calculation took: " << (double)final / ((double)CLOCKS_PER_SEC) << " seconds. (C++ loop)" << endl;

	init=clock();
	answer = findProductOCL(matrix, v, MATRIX_ROWS, MATRIX_COLS);	
	final=clock()-init;

	cout << answer[2999] << endl;
	cout << "Calculation took: " << (double)final / ((double)CLOCKS_PER_SEC) << " seconds. (Basic OpenCL, with initialization)" << endl;

	char myChar;
	cin >> myChar;

}